package com.ruoyi.shop.modules.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.shop.modules.domain.Comment;
import com.ruoyi.shop.modules.mapper.CommentMapper;
import com.ruoyi.shop.modules.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品评价Service业务层处理
 *
 * @author zjc
 * @date 2024-07-02
 */
@Service
public class CommentServiceImpl implements ICommentService
{
    @Autowired
    private CommentMapper commentMapper;


    /**
     * 新增商品评价
     *
     * @param comment 商品评价
     * @return 结果
     */
    @Override
    public int insertComment(Comment comment)
    {
        comment.setCreateTime(DateUtils.getNowDate());
        return commentMapper.insertComment(comment);
    }




    @Override
    public List<Comment> selectCommentListByProductId(Long pid) {
        return commentMapper.selectCommentListByProductId(pid);
    }


}
